﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>HelloWorldSync: HelloWorld.cpp Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                Examples using state machines generated by StateBuilderCpp
            </h1>
            <h3>
                HelloWorldSync: HelloWorld.cpp Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">HelloWorld.cpp</div>  </div>
</div>
<div class="contents">
<a href="_hello_world_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;ObserverStd.h&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="_hello_world_8h.html">HelloWorld.h</a>&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;HelloWorldFsm.h&quot;</span> <span class="comment">// Generated file</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="keyword">using namespace </span>std;
<a name="l00008"></a>00008 
<a name="l00009"></a><a class="code" href="class_hello_world.html#adcfd06a0c8114f03619d108f22f0ea15">00009</a> <a class="code" href="class_hello_world.html#adcfd06a0c8114f03619d108f22f0ea15">HelloWorld::HelloWorld</a>()
<a name="l00010"></a>00010 {
<a name="l00011"></a>00011     cout &lt;&lt; <span class="stringliteral">&quot;HelloWorld::ctor()&quot;</span> &lt;&lt; endl;
<a name="l00012"></a>00012     m_pContext = <span class="keyword">new</span> HelloWorldContext(*<span class="keyword">this</span>);
<a name="l00013"></a>00013     m_pContext-&gt;SetObserver(fsm::ObserverStd::GetInstance());
<a name="l00014"></a>00014     m_pContext-&gt;EnterInitialState();
<a name="l00015"></a>00015     m_pContext-&gt;SetManagement(<span class="keyword">this</span>);
<a name="l00016"></a>00016 }
<a name="l00017"></a>00017 
<a name="l00018"></a><a class="code" href="class_hello_world.html#a9a5716edac248441d78476abed771147">00018</a> <a class="code" href="class_hello_world.html#a9a5716edac248441d78476abed771147">HelloWorld::~HelloWorld</a>()
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020     cout &lt;&lt; <span class="stringliteral">&quot;HelloWorld::dtor()&quot;</span> &lt;&lt; endl;
<a name="l00021"></a>00021     <span class="keyword">delete</span> m_pContext;
<a name="l00022"></a>00022 }
<a name="l00023"></a>00023 
<a name="l00024"></a><a class="code" href="class_hello_world.html#a39afc7b7c38c07f63351351d5a42d0eb">00024</a> <span class="keywordtype">void</span> <a class="code" href="class_hello_world.html#a39afc7b7c38c07f63351351d5a42d0eb">HelloWorld::start</a>()
<a name="l00025"></a>00025 {
<a name="l00026"></a>00026     cout &lt;&lt; <span class="stringliteral">&quot;HelloWorld::start()&quot;</span> &lt;&lt; endl;
<a name="l00027"></a>00027     m_pContext-&gt;evStart();
<a name="l00028"></a>00028 }
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="class_hello_world.html#a94f70617888bd14f604c2a5f8b51e41a">00030</a> <span class="keywordtype">void</span> <a class="code" href="class_hello_world.html#a94f70617888bd14f604c2a5f8b51e41a">HelloWorld::stop</a>()
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032     cout &lt;&lt; <span class="stringliteral">&quot;HelloWorld::stop()&quot;</span> &lt;&lt; endl;
<a name="l00033"></a>00033     m_pContext-&gt;evStop();
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00036"></a><a class="code" href="class_hello_world.html#a46b0c886d32acb7dd4fc9d289f839413">00036</a> <span class="keywordtype">void</span> <a class="code" href="class_hello_world.html#a46b0c886d32acb7dd4fc9d289f839413">HelloWorld::print</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;message)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038     cout &lt;&lt; message &lt;&lt; endl;
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="class_hello_world.html#a4995404fbd85a6e3c784fa85c3b649bf">00041</a> <span class="keywordtype">void</span> <a class="code" href="class_hello_world.html#a4995404fbd85a6e3c784fa85c3b649bf">HelloWorld::OnEnd</a>()
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043     cout &lt;&lt; <span class="stringliteral">&quot;HelloWorld::OnEnd() context has ended&quot;</span> &lt;&lt; endl;
<a name="l00044"></a>00044 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
